package com.thiswhyme.republish.rabbitmq.config;

import com.thiswhyme.republish.common.CommonConstants;

import java.util.Arrays;
import java.util.List;

/**
 * @description: org.springframework.cloud.stream.config.BindingProperties增强配置
 * @author: thiswhyme
 * @date: 2021/3/22
 */
public class BindingPlusProperties {

    /**
     * 是否开启发送失败重发（发送测使用）
     */
    private Boolean enableRepublish = false;

    /**
     * 是否需要存储（仅针对无需重发的场景，即enableRepublish=false时该配置有效,发送测使用）
     */
    private Boolean enableStore = false;

    /**
     * 发送失败重发上限次数，默认3（发送测使用）
     */
    private Integer republishTimes = CommonConstants.DEFAULT_REPUBLISH_LIMIT_TIMES;

    /**
     * 消费失败重试上限次数，默认3（消费测使用）
     */
    private Integer retryTimes = CommonConstants.DEFAULT_RETRY_LIMIT_TIMES;

    /**
     * 发送失败延迟重发时间（发送测使用，毫秒），与republishTimes配合使用，默认第一次延时1000ms，第二次延时2000ms，第三次延时4000ms
     */
    private List<Integer> delayRepublishMillis = Arrays.asList(1000, 2000, 4000);

    /**
     * 消费失败延迟重发时间（消费测使用，毫秒），与retryTimes配合使用，默认第一次延时1000ms，第二次延时2000ms，第三次延时4000ms
     */
    private List<Integer> delayRetryMillis = Arrays.asList(1000, 2000, 4000);

    /**
     * 消息内容类型，默认String
     */
    private Class messageContentClazz = String.class;

    /**
     * 同org.springframework.cloud.stream.config.BindingProperties
     */
    private String destination;

    public Boolean getEnableRepublish() {
        return enableRepublish;
    }

    public void setEnableRepublish(Boolean enableRepublish) {
        this.enableRepublish = enableRepublish;
    }

    public Boolean getEnableStore() {
        return enableStore;
    }

    public void setEnableStore(Boolean enableStore) {
        this.enableStore = enableStore;
    }

    public Integer getRepublishTimes() {
        return republishTimes;
    }

    public void setRepublishTimes(Integer republishTimes) {
        this.republishTimes = republishTimes;
    }

    public Integer getRetryTimes() {
        return retryTimes;
    }

    public void setRetryTimes(Integer retryTimes) {
        this.retryTimes = retryTimes;
    }

    public List<Integer> getDelayRepublishMillis() {
        return delayRepublishMillis;
    }

    public void setDelayRepublishMillis(List<Integer> delayRepublishMillis) {
        this.delayRepublishMillis = delayRepublishMillis;
    }

    public List<Integer> getDelayRetryMillis() {
        return delayRetryMillis;
    }

    public void setDelayRetryMillis(List<Integer> delayRetryMillis) {
        this.delayRetryMillis = delayRetryMillis;
    }

    public Class getMessageContentClazz() {
        return messageContentClazz;
    }

    public void setMessageContentClazz(Class messageContentClazz) {
        this.messageContentClazz = messageContentClazz;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }
}
